<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试加密接口</title>
</head>
<body>

<script src="js/aescon.js"></script>
<script src="js/lib/zepto.min.js"></script>

<script>
    function getApi() {
        var url='/server/serverTime';
        var mdObj=md5Fun(null,url,null);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================serverTime')
     $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                //request.setRequestHeader("userId", '61c0cc2c8a054be9ff63749088882f0d');
                //request.setRequestHeader("token", '61c0cc2c8a054be9ff63749088882f0d');
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log('========================')
            },
            error: function(e) {

            }
        });
    }

    function getLogin() {
        var url='/user/login';
        var mdObj=md5Fun(null,url,null);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================login')
        //var parameter=Encrypt('{"userName":"15815583694","passWord":"123456"}');
        //var parameter=Encrypt('{"userName":"13570529358","passWord":"123456"}');
        var parameter=Encrypt('{"userName":"13300000000","passWord":"123456"}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                //request.setRequestHeader("userId", '61c0cc2c8a054be9ff63749088882f0d');
                //request.setRequestHeader("token", '61c0cc2c8a054be9ff63749088882f0d');
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
            },
            error: function(e) {

            }
        });
    }
    var token='25539d5f5319cd02387d6689823017cf';
    var userId='1769';
    function findOrgAndEquipmentType() {
        //http://192.168.31.33:8085/api/mes/statis/findOrgAndEquipmentType
        var url='/mes/statis/findOrgAndEquipmentType';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        //var parameter=Encrypt('{"userName":"15815583694","passWord":"123456"}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            /*data:JSON.stringify(
                {"parameter":parameter}
            ),*/
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }

    //根据设备类型查询所有设备
    function findEquipment() {
        //http://192.168.31.33:8085/api/mes/statis/findOrgAndEquipmentType
        var url='/mes/statis/findEquipment';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameter=Encrypt('{"type":"7"}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }

    //物料统计 所占物料总重比例
    function queryMaterialDate() {
        //http://192.168.31.33:8085/api/mes/statis/findOrgAndEquipmentType
        var url='/mes/statis/queryMaterialDate';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameter=Encrypt('{"type":"","yeas":"2017","month":"1","customerName":""}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }

    //人员生产效率--注塑
    function productivityOfPlastic() {
        var url='/mes/statis/productivityOfPlastic';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameter=Encrypt('{"type":"","yeas":"2017","month":"1","customerName":""}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }
    //统计人员生产率---金属&模具
    function productivityOfMetalAndMould() {
        var url='/mes/statis/productivityOfMetalAndMould';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameter=Encrypt('{"type":"","yeas":"","month":"","customerName":""}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }
    //查询人员工时占比
    function queryPersonalOccupationTime() {
        //http://192.168.31.33:8085/api/mes/statis/findOrgAndEquipmentType
        var url='/mes/statis/queryPersonalOccupationTime';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameter=Encrypt('{"year":"2017","month":"1"}');
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }

    //生产单进度
    function queryProductionSchedule() {
        //http://192.168.31.33:8085/api/mes/statis/findOrgAndEquipmentType
        var url='/mes/statis/queryProductionSchedule';
        var mdObj=md5Fun(token,url,userId);
        console.log('sequence='+mdObj.sequence);
        console.log('nonceStr='+mdObj.nonceStr);
        console.log('sign='+mdObj.sign);
        console.log('========================'+url)
        var parameterObj= {

        };
        var parameter=Encrypt(JSON.stringify(parameterObj));
        console.log(Decrypt(parameter));
        $.ajax({
            type: "POST",
            timeout : 5000,
            url: webUrl+url,
            data:JSON.stringify(
                {"parameter":parameter}
            ),
            beforeSend: function(request) {
                request.setRequestHeader("Content-Type", "application/json");
                request.setRequestHeader("sequence", mdObj.sequence);
                request.setRequestHeader("nonceStr", mdObj.nonceStr);
                request.setRequestHeader("userId", userId);
                request.setRequestHeader("token", token);
                //request.setRequestHeader("infName", url);
                //request.setRequestHeader("osVersion", '');
                request.setRequestHeader("versionType", "1");
                request.setRequestHeader("osPlatform", mdObj.osPlatform);
                request.setRequestHeader("appVersion", mdObj.appVersion);
                request.setRequestHeader("sign", mdObj.sign);
            },
            success: function (data) {
                console.log(data)
                var content=Decrypt(data.content)
                console.log(content)
                console.log(JSON.parse(content));
            },
            error: function(e) {

            }
        });
    }

    $(document).ready(function(){
        //getApi()
        //getLogin()
    });
</script>

</body>
</html>